package com.cat.decorator;

/**
 * @author cat
 * @version 2025/5/21 17:06
 * @description 鸡蛋类(具体装饰者角色)
 * @since JDK17
 */

public class Egg extends Garnish {
    public Egg(FastFood fastFood) {
        super(fastFood, 1, "鸡蛋");
    }

    @Override
    public float cost() {
        // 计算价格，this用来存储配件的价格，fastFood用来存储本体的价格
        return super.getPrice() + getFastFood().cost();
    }

    @Override
    public String getDesc() {
        return super.getDesc() + getFastFood().getDesc();
    }
}
